package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.FTax;
import com.ruoyi.system.service.IFTaxService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 税务管理Controller
 * 
 * @author qi
 * @date 2024-05-08
 */
@RestController
@RequestMapping("/system/tax")
public class FTaxController extends BaseController
{
    @Autowired
    private IFTaxService fTaxService;

    /**
     * 查询税务管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:tax:list')")
    @GetMapping("/list")
    public TableDataInfo list(FTax fTax)
    {
        startPage();
        List<FTax> list = fTaxService.selectFTaxList(fTax);
        return getDataTable(list);
    }

    /**
     * 导出税务管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:tax:export')")
    @Log(title = "税务管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FTax fTax)
    {
        List<FTax> list = fTaxService.selectFTaxList(fTax);
        ExcelUtil<FTax> util = new ExcelUtil<FTax>(FTax.class);
        util.exportExcel(response, list, "税务管理数据");
    }

    /**
     * 获取税务管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:tax:query')")
    @GetMapping(value = "/{fTaxid}")
    public AjaxResult getInfo(@PathVariable("fTaxid") Long fTaxid)
    {
        return success(fTaxService.selectFTaxByFTaxid(fTaxid));
    }

    /**
     * 新增税务管理
     */
    @PreAuthorize("@ss.hasPermi('system:tax:add')")
    @Log(title = "税务管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FTax fTax)
    {
        return toAjax(fTaxService.insertFTax(fTax));
    }

    /**
     * 修改税务管理
     */
    @PreAuthorize("@ss.hasPermi('system:tax:edit')")
    @Log(title = "税务管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FTax fTax)
    {
        return toAjax(fTaxService.updateFTax(fTax));
    }

    /**
     * 删除税务管理
     */
    @PreAuthorize("@ss.hasPermi('system:tax:remove')")
    @Log(title = "税务管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{fTaxids}")
    public AjaxResult remove(@PathVariable Long[] fTaxids)
    {
        return toAjax(fTaxService.deleteFTaxByFTaxids(fTaxids));
    }
}
